package com.gdpu.liou.symphonyserver.entity.respose;

import lombok.Data;

/**
 * @author liou
 * @create 2022/1/19 10:10 周三
 */
@Data
public class Response<T> {
    /**
     * 状态
     */
    private Integer code = 200;
    /**
     * 消息
     */
    private String msg = "请求成功";
    /**
     * 数据
     */
    private T data;

    /**
     * 数据的数量
     */
    private Integer count = 0;

    public Response() {
    }

    public Response(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Response(T data) {
        this.data = data;
        this.count = 1;
    }

    public Response(T data, int count) {
        this.data = data;
        this.count = count;
    }

    public Response(Integer code, String msg, T data, Integer count) {
        this.code = code;
        this.msg = msg;
        this.data = data;
        this.count = count;
    }

    public Response(ResponseCode responseCode) {
        this.code = responseCode.getCode();
        this.msg = responseCode.getMessage();
    }


}
